var
	a:array[1..100] of longint;
	i,n,t:longint;
begin
	read(n);
	for i:=1 to n do
		read(a[i]);
	for i:=1 to n do
		write(a[i],' ');
	writeln;
	t:=a[1];
	for i:=1 to n-1 do
		a[i]:=a[i+1];
	a[n]:=t;
	for i:=1 to n do
		write(a[i],' ');
	writeln;
end.
